package domain;

import java.sql.Date;

public class BookFromLibrary implements IGeneralDomainObject {

	/*------------------------
	 * BookFromLibrary attributes
	 * ------------------------
	 */

	private int libraryID, bookID, numExtend;
	//private Date bookBorrowDate;
	private long milliseconds;

	private String searchCondition;

	public BookFromLibrary() {
	}

	public BookFromLibrary(int bookID, int libraryID, long milliseconds) {
		super();
		this.bookID = bookID;
		this.libraryID = libraryID;
//		/this.bookBorrowDate = bookBorrowDate;
		this.milliseconds = milliseconds;
		this.numExtend = 0;
	}

	public BookFromLibrary(int libraryID, int bookID) {
		super();
		this.libraryID = libraryID;
		this.bookID = bookID;
		this.numExtend = 0;
	}
	
	/*------------------------
	 * attributes getters&setters
	 * -----------------------
	 */	

	public int getLibraryID() {
		return libraryID;
	}

	public void setLibraryID(int libraryID) {
		this.libraryID = libraryID;
	}

	public int getBookID() {
		return bookID;
	}

	public void setBookID(int bookID) {
		this.bookID = bookID;
	}

	public int getNumExtend() {
		return numExtend;
	}

	public void setNumExtend(int numExtend) {
		if (numExtend < 0)
			numExtend = 0;
		this.numExtend = numExtend;
	}

//	public Date getBookBorrowDate() {
//		return bookBorrowDate;
//	}
//
//	public void setBookBorrowDate(Date bookBorrowDate) {
//		this.bookBorrowDate = bookBorrowDate;
//	}
	

	// -------------- END getters&setters ----------------- //

	/*
	 * -------------------------- IGeneralDomainObject implementation
	 * ---------------------------
	 */
	@Override
	public String getTableName() {
		return "TBookFromLibrary(bookID,libraryID,date,numExtend)";
	}

	public long getMilliseconds() {
		return milliseconds;
	}

	public void setMilliseconds(long milliseconds) {
		this.milliseconds = milliseconds;
	}

	@Override
	public String getUniqueCondition() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getInsertValues() {
		return getBookID() + "," + getLibraryID() + ","
				+ getMilliseconds()
				+ "," + getNumExtend();
	}

	@Override
	public String[] getColumnsNames() {
		return new String[] { "libraryID", "bookID", "numExtend", "date" };
	}

	@Override
	public String getSimpleTableName() {
		return "TBookFromLibrary";
	}

	@Override
	public String getFindValue() {
		return " bookID=" + getBookID() + " AND libraryID=" + getLibraryID();
	}

	@Override
	public String toString() {
		return "bookID: " + bookID + ", libraryID: " + libraryID;
	}

	@Override
	public String getUpdateValue() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getDeleteValue() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getDeleteCondition() {
		// TODO Auto-generated method stub
		return null;
	}
}
